//
//  StarCell.m
//  XDBaseFrameWork
//
//  Created by XD-XY on 9/24/14.
//  Copyright (c) 2014 XD-XY. All rights reserved.
//

#import "StarCell.h"

@implementation StarCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self makeViews];
    }
    return self;
}

-(void)makeViews
{
    
    self.upline = [UIView initViewRect:CGRectMake(0, 0, UI_SCREEN_WIDTH, 0.5) andBackGroudColor:UIColorFromRGB(0xd4ccc5)];
    
    self.downline = [UIView initViewRect:CGRectMake(0, 41.5, UI_SCREEN_WIDTH, 0.5) andBackGroudColor:UIColorFromRGB(0xd4ccc5)];
    
    self.customNumberOfStars = [[DLStarRatingControl alloc] initWithFrame:CGRectMake(-10, 0,20*6+10, 42) andStars:5 isFractional:YES];
	_customNumberOfStars.backgroundColor = [UIColor clearColor];
	_customNumberOfStars.autoresizingMask =  UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
    _customNumberOfStars.enabled = NO;
    
    self.starLB = [UILabel initLabelText:@"" andRect:CGRectMake(268/2.0f-5,1, 50, 40) andBackGroudColor:mClearColor andTextFont:[UIFont systemFontOfSize:16] andTextColor:UIColorFromRGB(0xffa200) andTextAlignment:NSTextAlignmentLeft];
    
    
    self.arrowsIV = [UIImageView initImageViewRect:CGRectMake(UI_SCREEN_WIDTH-15-7, 31/2.0f, 7, 11) andImage:LOADIMAGE(@"arrow_cell@2x") andUserInteractionEnabled:YES];
    
    self.rightLB = [UILabel initLabelText:@"" andRect:CGRectMake(0, 0, UI_SCREEN_WIDTH-30, 42)andBackGroudColor:mClearColor andTextFont:[UIFont systemFontOfSize:15.5] andTextColor:UIColorFromRGB(0x453d35) andTextAlignment:NSTextAlignmentRight];
    
	[self.contentView addSubview:_customNumberOfStars];
    [self.contentView addSubview:_starLB];
    [self.contentView addSubview:_rightLB];
    [self.contentView addSubview:_arrowsIV];

    
    [self.contentView addSubview:_downline];
    [self.contentView addSubview:_upline];
}

-(void)resetViewWithSynDtailsVC
{
    _downline.hidden = YES;
    _upline.hidden = YES;
    self.backgroundColor = UIColorFromRGB(0xf1f1f1);
    
    _customNumberOfStars.frame = CGRectMake(-10, 0,20*6+10, 30.5);
    _starLB.frame = CGRectMake(268/2.0f-5,1, 50, 30.5-2);
    _arrowsIV.frame = CGRectMake(UI_SCREEN_WIDTH-15-7, 19.5/2.0f, 7, 11);
    _rightLB.frame = CGRectMake(0, 0, UI_SCREEN_WIDTH-30, 30.5);
    
    
    
}

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
